    //The renderInfo() method is required in every gadget.js compiled by this project's ant script.
    //It will receive all callbacks. Sorry if this is to simplistic for you needs;
    //I'm sure we can think of something more flexible in due time.
    
    function renderInfo() {
      if (!wave.getState()) {
        return;
      }
      renderOwnItems();
      htmlSet("fbdate", friday());
      clearTable();
      var state = wave.getState();
      var participants = wave.getParticipants();
      for (var i = 0; i < participants.length; ++i) {
          var participant = participants[i];
          var participantState = stateFor(participant);
          var place = 0;
          for (var timeIndex = 0 ; timeIndex < 5 ; timeIndex++) {
            var newPlace = participantState[timeIndex];
            place = (0 == newPlace) ? place : newPlace;
            if ((1 == place) || (2 == place)) {
              htmlAdd("fb" + timeIndex + "" + place, "<img src ='" + participant.getThumbnailUrl() + "' title='" + participant.getDisplayName() + "' height='40' width='40'/>"); 
            };
          };
      }
      
      //Resize gadget height to fit the actual content
      gadgets.window.adjustHeight();
    }

    //Clears all table dynamic content cells in the overview table
    function clearTable() {
        for (var pli = 1 ; pli < 3 ; pli++) {
          for (var tii = 0 ; tii < 5 ; tii++) {
            htmlSet("fb" + tii + "" + pli, "");
          }
        }
    }
    
    //Renders the top of the two dynamic boxes in the gadget
    function renderOwnItems() {
      var ownState = stateFor(wave.getViewer());
      logThis(ownState);
      htmlSet("ownItems", "");
      var itemCount = 0;
      for (var i = 0; i < 5; ++i) {
        if (ownState[i] != 0) {
          htmlAdd("ownItems", itemHtml(i, ownState[i]));
          itemCount++;
        }
      }
      if (0 == itemCount) {
        htmlSet("ownItems", "You have not published any intentions yet");
      }    
    }
    
    var times = ["quite early", "around 4", "around 5", "sometime", "quite late"];
    var places = ["Trafalmadore", "&Oslash;rsted", "Some other fine bar", "Home"];
    
    function itemHtml(timeIndex, placeIndex) {
      var html = "<div><img onclick='removeTime(" + timeIndex + ")' style='vertical-align: middle' height='25' width='25' src='";
      html += "http:/";
      html += "/upload.wikimedia.org/wikipedia/commons/archive/2/23/20050813124355!Symbol_oppose_vote.png'/>";
      html += places[placeIndex] + " " + times[timeIndex];
      html += "</div>";
      return html;
    }
    
    //Returns a readable string describing the upcoming Friday
    function friday() {
      var myDate=new Date();
      while (myDate.getDay() != 5) {
        myDate.setDate(myDate.getDate()+1);    
      }
      return myDate.toDateString();
    }
    
    //Returns the deduced state for any participant
    function stateFor(participant) {
      var state = wave.getState();
      var found = state.get(friday() + participant.getId());
      if (!found) {
        return [0, 0, 0, 0, 0];
      } else {
        return eval(found);
      }
    }
    
    //Utility because I always type it wrongly and don't want to include JQuery just yet
    function htmlSet(htmlId, value) {
      document.getElementById(htmlId).innerHTML = value;
    }
    
    //Utility because I always type it wrongly and don't want to include JQuery just yet
    function htmlAdd(htmlId, value) {
      document.getElementById(htmlId).innerHTML += value;
    }
    
    //Utility because I always type it wrongly and don't want to include JQuery just yet
    function numValueOf(htmlId) {
      return new Number(document.getElementById(htmlId).value);
      
      document.getElementById(htmlId).innerHTML += value;
    }    

    //This method is called when a dropdown value is changed.
    //This method saves new choices in the gadget state.
    function setState(key, value) {
      delta = {};
      delta["" + key] = "" + value;
      logThis(delta);
      wave.getState().submitDelta(delta);
    }
    
    function stringify(state) {
      var strState = "[";
      strState += state[0] + ",";
      strState += state[1] + ",";
      strState += state[2] + ",";
      strState += state[3] + ",";
      strState += state[4];
      strState += "]";
      return strState;
    }

    //This method is called when the viewer adds a new item.
    //It updates the gadget state.
    function addTimeAndPlace() {
      var ownState = stateFor(wave.getViewer());
      ownState[numValueOf("fbtime")] = numValueOf("fbplace");
      setState(friday() + wave.getViewer().getId(), stringify(ownState));
    }
    
    //This method is called when the viewer removes an item.
    //It updates the gadget state.
    function removeTime(timeIndex) {
      var ownState = stateFor(wave.getViewer());
      ownState[timeIndex] = 0;
      setState(friday() + wave.getViewer().getId(), stringify(ownState));
    }
    